home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / info / drdtips.zip / 1117.TXT < prev    next >
Text File  |  1992-06-05  |  2KB  |  51 lines

  1. Document 1117
  2. DIREXIST Command
  3. 06/05/92
  4.                     Novell Desktop Systems Group
  5.  
  6. Some installation batch files will ask the user to provide a directory name
  7. to use for their installation.  The batch file then checks to see if the
  8. directory exists, and if not then it will create one.
  9.  
  10. DR DOS has enhanced many area, but in doing so, a new driver named NUL came
  11. in conflict with an older methodology for checking the existance of, and
  12. creating directories.
  13.  
  14. The command:  IF EXIST %1\NUL   will no longer work with DR DOS, however
  15. there is an improved batch file parser that actually provides a much more
  16. convenient method, the command is:   DIREXIST %1
  17.  
  18. See page 128 of the DR DOS 6.0 User Guide for more information.
  19. Example:
  20.     
  21. @ECHO OFF
  22. echo  ┌──────────────────────────────────────────────────────────────────┐
  23. echo  │ file: IFDIR.BAT                                                  │ 
  24. echo  └──────────────────────────────────────────────────────────────────┘
  25. echo  .                                                                  .
  26. echo  ╔══════════════════════════════════════════════════════════════════╗
  27. echo  ║ Testing DIREXIST directory creation from a batch file            ║
  28. echo  ║                                                                  ║
  29. echo  ║ NOTE:               IF NOT EXIST %1\NUL                          ║
  30. echo  ║                                                                  ║
  31. echo  ║ The above convention does not work with DR DOS as a device       ║
  32. echo  ║ driver called NUL has been loaded for additional functionality.  ║
  33. echo  ║                                                                  ║
  34. echo  ║ An inhancement to batch file processing provides the same        ║
  35. echo  ║ result, but with a more consistant batch file interface.         ║
  36. echo  ║                                                                  ║
  37. echo  ╚══════════════════════════════════════════════════════════════════╝
  38. if "%1"=="" goto oops
  39. if DIREXIST %1 echo Directory Already Exists
  40.  
  41. IF NOT DIREXIST %1   MD %1
  42.  
  43. if DIREXIST %1 echo Directory %1 made with DIREXIST.
  44. dir *.
  45. exit
  46.  
  47. :oops
  48. echo  ┌──────────────────────────────────────────────────────────────────┐
  49. echo  │ OOPS!:  Need a directory name to create, try:  IFDIR.BAT C:\TEST │
  50. echo  └──────────────────────────────────────────────────────────────────┘
  51.